package com.comcast.oncampus.tests.page;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;

public class LoginPage {

	private final WebDriver driver;

	public LoginPage(WebDriver driver) {
		this.driver = driver;
	}

	public void loginToEmersonPage(String username, String password) {
		WebElement usernameField = driver.findElement(By.id("username"));
		WebElement passwordField = driver.findElement(By.id("password"));

		//Send username and password to form
		usernameField.sendKeys(username);
		passwordField.sendKeys(password);

		//Click on Login login-form-submit
		WebElement loginButton = driver.findElement(By.id("login-form-submit")).findElement(By.tagName("input"));
		loginButton.click();
	}
	
	public void loginToDrexelPage(String username, String password) {
		WebElement usernameField = driver.findElement(By.id("username"));
		WebElement passwordField = driver.findElement(By.id("user_pass"));
		
		//Send data to login form
		usernameField.sendKeys(username);
		passwordField.sendKeys(password);
		
		//Click on Login button
		WebElement loginButton = driver.findElement(By.id("wp-submit"));
		new Actions(driver).moveToElement(loginButton).click().perform();
	}

}